using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class ProjectMap : EntityTypeConfiguration<Project>
    {
        public ProjectMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.Desc)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Supervisor)
                .HasMaxLength(50);

            this.Property(t => t.CustId)
                .HasMaxLength(6);

            this.Property(t => t.FirstContact)
                .HasMaxLength(35);

            this.Property(t => t.FirstContactPhone)
                .HasMaxLength(15);

            this.Property(t => t.SecondContact)
                .HasMaxLength(35);

            this.Property(t => t.SecondContactPhone)
                .HasMaxLength(15);

            this.Property(t => t.File_Primery_Key)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("Project");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Desc).HasColumnName("Desc");
            this.Property(t => t.Supervisor).HasColumnName("Supervisor");
            this.Property(t => t.CustId).HasColumnName("CustId");
            this.Property(t => t.FirstContact).HasColumnName("FirstContact");
            this.Property(t => t.FirstContactPhone).HasColumnName("FirstContactPhone");
            this.Property(t => t.SecondContact).HasColumnName("SecondContact");
            this.Property(t => t.SecondContactPhone).HasColumnName("SecondContactPhone");
            this.Property(t => t.Inactive).HasColumnName("Inactive");
            this.Property(t => t.File_Primery_Key).HasColumnName("File Primery Key");
            this.Property(t => t.PJ_Amount).HasColumnName("PJ_Amount");
            this.Property(t => t.PJ_StartDate).HasColumnName("PJ_StartDate");
            this.Property(t => t.PJ_EndDate).HasColumnName("PJ_EndDate");
        }
    }
}
